package org.example.service;

import org.example.entity.OrderDetailet;
import org.example.mapper.IOrderDetailetMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class OrderDetailetService {

    @Autowired
    private IOrderDetailetMapper orderDetailetMapper;

    // 批量插入订单明细
    public void saveOrderDetailetList(List<OrderDetailet> orderDetailetList) {
        for (OrderDetailet orderDetailet : orderDetailetList) {
            orderDetailetMapper.insert(orderDetailet); // 插入单条订单明细
        }
    }

    // 根据订单ID查询订单明细
    public List<OrderDetailet> getOrderDetailetByOrderId(Integer orderId) {
        return orderDetailetMapper.selectByOrderId(orderId);
    }
} 